#include<stdio.h>

#define N 4

int encrypted(int num);
int main()
{
	int num;
	int ans;
	printf("请输入一个四位整数：");
	scanf("%d", &num);

	ans = encrypted(num);
	printf("The encrypted number is %d\n", ans);

	return 0;
}

int encrypted(int num){
	int ans = 0;
	int tem;

	int arr[N] = {0};
	for(int i = 0; i < 4; i++){// 个位开始存
		arr[i] = (num%10+9)%10;
		num/=10;
	}
	
	for(int i = 0; i < N/2; i++){
		int tem = arr[i];
		arr[i] = arr[i+2];
		arr[i+2] = tem;
	}

	for(int i = N-1; i >= 0; i--){
		ans = ans*10 + arr[i];
	}

	return ans;

}
